package dm.ass1.io;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.Writable;

public class RatingWritable implements Writable {

	private int user;
	private int item;
	private int rating;
	
	public RatingWritable() {
		
	}
	
	public RatingWritable(int user, int item, int rating) {
		super();
		this.user = user;
		this.item = item;
		this.rating = rating;
	}

	public int getUser() {
		return user;
	}


	public int getItem() {
		return item;
	}


	public int getRating() {
		return rating;
	}


	@Override
	public void readFields(DataInput in) throws IOException {
		this.user = in.readInt();
		this.item = in.readInt();
		this.rating = in.readInt();
	}

	@Override
	public void write(DataOutput out) throws IOException {
		out.writeInt(this.user);
		out.writeInt(this.item);
		out.writeInt(this.rating);
	}

}
